package com.lanou.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lanou.entity.Course;
import com.lanou.entity.HomeCarousel;
import com.lanou.mapper.HomeCarouselMapper;
import com.lanou.service.HomeCarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName HomeCarouselServiceImpl
 * @Description TODO
 * @Author cuipengwei
 * @Date 2025年08月15日 10:14
 * @Version 1.0
 */
@Service
public class HomeCarouselServiceImpl implements HomeCarouselService {
    @Autowired
    private HomeCarouselMapper homeCarouselMapper;
    //增加
    @Override
    public Integer addHomeCarousel(HomeCarousel homeCarousel) {
        Integer i = homeCarouselMapper.addHomeCarousel(homeCarousel);
        return i;
    }
    //删除
    @Override
    public Integer deleteHomeCarousel(Integer id) {
        Integer i = homeCarouselMapper.deleteHomeCarousel(id);
        return i;
    }

    @Override
    public PageInfo<HomeCarousel> selectHomeCarousel(HomeCarousel homeCarousel, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<HomeCarousel> homeCarousels = homeCarouselMapper.selectHomeCarousel(homeCarousel);
        PageInfo<HomeCarousel> pageInfo = new PageInfo<>(homeCarousels);
        return pageInfo;
    }

}
